#include("common.html")
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>商城</title>
    
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <meta name="full-screen" content="yes">
    <meta name="x5-fullscreen" content="true">
    <link rel="stylesheet" type="text/css" href="#(tpath)/static/css/vant.css">
    <link rel="stylesheet" type="text/css" href="#(tpath)/static/css/filter.css">
	<link rel="stylesheet" type="text/css" href="#(tpath)/static/toast/animate.css">
	<link rel="stylesheet" type="text/css" href="#(tpath)/static/toast/toast.css">
    <script type="text/javascript" src="#(tpath)/static/js/jquery.js"></script>
    <script type="text/javascript" src="#(tpath)/static/toast/toast.js"></script>
  </head>
  
  <body class="">
    <style type="text/css">@media only screen and (min-width: 320px){ html { font-size: 62.5% !important; } } @media only screen and (min-width: 640px){ html { font-size: 125% !important; } } @media only screen and (min-width: 750px){ html { font-size: 150% !important; } } @media only screen and (min-width: 1242px){ html { font-size: 187.5% !important; } }</style>
    <!-- 样式 -->
    <style>.container { background: #f8f8f8; overflow: hidden; height: 100%; box-sizing: border-box; font-size: 14px; color: #666; position: relative; } .van-cell-group { background-color: #fff; } [class*=van-hairline]::after{ border: none; } .van-cell { padding: 20px 15px; } .van-field .van-cell__title{max-width: 75px;} .submitBox{margin:20px 0px;} .van-radio-group{height:40px} .van-radio { float: left; margin-right: 10px; color: #666; height: 40px; } .van-radio__label{ font-size:12px; margin-left: 5px; } .back-bt{ margin-top: 10px; } #errorTip{height: 22px;} .copyright-content{ position: fixed; bottom: 30px; width: 100%; text-align: center; font-size: 12px; color: #999; }</style>
    <!-- 内容 -->
    <div id="reg" class="container">
      <div class="small_block_title">
        <h1>忘记密码</h1></div>
      <div class="small_block_content">
        <div class="van-cell-group van-hairline--top-bottom">
          <input type="hidden" id="username" value="#(username)">
          <div class="van-cell van-cell--center van-cell--required van-field">
            <!---->
            <div class="van-cell__title">
              <span>短信验证码</span>
              <!----></div>
            <div class="van-cell__value">
              <div class="van-field__body">
                <input type="text" placeholder="输入短信验证码" class="van-field__control" id="code">
                <!---->
                <!---->
                <!----></div>
              <!----></div>
            <!----></div>
          <div class="van-cell van-cell--center van-cell--required van-field">
            <!---->
            <div class="van-cell__title">
              <span>设置密码</span>
              <!----></div>
            <div class="van-cell__value">
              <div class="van-field__body">
                <input type="password" placeholder="至少6位数" class="van-field__control" id="password">
                <!---->
                <!---->
                <!----></div>
              <!----></div>
            <!----></div>
        </div>
        <div class="submitBox">
          <button class="submit van-button van-button--primary van-button--large" id="registerBtn">
            <span class="van-button__text">确认修改</span></button>
          <button class="back-bt van-button van-button--default van-button--large" onclick="location.href='#(base)/password'">
            <span class="van-button__text">返回</span></button>
        </div>
      </div>
      <div class="copyright-content">@2016-2023 JRECMS All Rights Reserved</div></div>
    <!-- 逻辑 -->
    <!-- 底部内容-->
    <style>#mini_footer { /* position: absolute; */ text-align: center; width: 100%; font-size: 12px; color: #ccc; bottom: 10px; background: #f8f8f8; height: 20px; line-height: 20px; z-index: 999; }</style>
    <!-- <div id="mini_footer">@2016-2023 JRECMS All Rights Reserved</div> -->
    <div class="van-toast van-toast--default van-toast--middle" style="z-index: 2002; display: none;">
      <!---->
      <!---->
      <i class="van-icon van-icon-success van-toast__icon">
        <!---->
        <!----></i>
      <div class="van-toast__text">发送成功</div></div>
  </body>

</html>
<script type="text/javascript">
$("#registerBtn").on("click",function(){
	var code = $("#code").val();
	if(code==""){
		showMessage('请输入短信验证码！',true);
		return false;
	}
	var password = $("#password").val();
	if(password==""){
		showMessage('请设置密码！',true);
		return false;
	}
	var username = $("#username").val();
	$.ajax({
        url: "#(base)/password/forgot",
        type: "post",
        data: {"username":username,"code":code,"password":password},
        dataType: "json",
        success: function(res){
        	if(res.type=="success"){
        		showMessage("修改成功",true);
        		setTimeout(function(){ location.href="#(base)/login"; }, 1500);
       		}else{
       			showMessage(res.msg,true);
       		}
        },
        error: function(res){
        }
    });
});
</script>